Problem Note 34544: ISO time informat B8601TM produces: NOTE: Invalid argument to function INPUT at line column
When using ISO time informat B8601TM without an explicit length specification, SAS may use the characters in memory following the variable as part of the input.
To replicate:
- specify character variable with length $6
- specify second character variable with length $2
- specify informat without length (B8601TM.), default length is 8 in documentation.
The result is:
NOTE: Invalid argument to function INPUT
The workaround is to specify explicit length when using informat to match the length of the input variable:
B8601TM6.
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft® Windows® for x64 | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | 9.2 TS2M2 |
Microsoft Windows XP Professional | 9.2 TS1M0 | 9.2 TS2M2 |
Windows Vista | 9.2 TS1M0 | 9.2 TS2M2 |
64-bit Enabled AIX | 9.2 TS1M0 | 9.2 TS2M2 |
64-bit Enabled HP-UX | 9.2 TS1M0 | 9.2 TS2M2 |
64-bit Enabled Solaris | 9.2 TS1M0 | 9.2 TS2M2 |
HP-UX IPF | 9.2 TS1M0 | 9.2 TS2M2 |
Linux | 9.2 TS1M0 | 9.2 TS2M2 |
Linux for x64 | 9.2 TS1M0 | 9.2 TS2M2 |
OpenVMS on HP Integrity | 9.2 TS1M0 | 9.2 TS2M2 |
Solaris for x64 | 9.2 TS1M0 | 9.2 TS2M2 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
/* specify character variable with length $6
specify second character variable with length $2
specify informat without length
See Invalid argument to function INPUT message
*/
data one;
x='123456';
pm = 'xx';
t = input(x,b8601tm.);
put t time.;
run;
/* specify character variable with length $6
specify second character variable with length $2
specify informat with length of 6
No Invalid argument message
*/
data two;
x='123456';
pm = 'xx';
t = input(x,b8601tm6.);
put t time.;
run;
/* specify character variable with length $6
specify second character variable with length $2
containing valid characters
specify informat without length
No Invalid argument message
*/
data three;
x='123456';
pm = '00';
t = input(x,b8601tm.);
put t time.;
run;
2
3 /* specify character variable with length $6
4 specify second character variable with length $2
5 specify informat without length
6 See Invalid argument to function INPUT message
7 */
8
9 data one;
10 x='123456';
11 pm = 'xx';
12 t = input(x,b8601tm.);
13 put t time.;
14 run;
NOTE: Invalid argument to function INPUT at line 12 column 7.
.
x=123456 pm=xx t=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results
of the operations have been set to missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 12:7
NOTE: The data set WORK.ONE has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.04 seconds
15
16 /* specify character variable with length $6
17 specify second character variable with length $2
18 specify informat with length of 6
19 No Invalid argument message
20 */
21 data two;
22 x='123456';
23 pm = 'xx';
24 t = input(x,b8601tm6.);
25 put t time.;
26 run;
12:34:56
NOTE: The data set WORK.TWO has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
27
28 /* specify character variable with length $6
29 specify second character variable with length $2
30 containing valid characters
31 specify informat without length
32 No Invalid argument message
33 */
34 data three;
35 x='123456';
36 pm = '00';
37 t = input(x,b8601tm.);
38 put t time.;
39 run;
12:34:56
NOTE: The data set WORK.THREE has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
ISO time informat B8601TM used without a specified length uses characters following the input variable if the input variable is shorter than 8 bytes.
Type: | Problem Note |
Priority: | low |
Topic: | SAS Reference ==> Informats ==> Date and Time
|
Date Modified: | 2009-06-26 15:23:00 |
Date Created: | 2009-01-19 16:54:21 |